import { generate } from './generate';
import { parseHTML } from './praseAst'

export function compileToFun(el) {
    // html 转 ast
    let ast = parseHTML(el);
    // ast 转 render
    let code = generate(ast)

    // 将render字符串变成函数
    let render = new Function(`with(this){return ${code}}`)
    return render
}
